package com.baidu.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author ShiLei
 * @version v1.0
 * @date 2020-03-13 0:03
 */
@RestController
@CrossOrigin
@Slf4j
public class OrderController {

    private static final String INVORK_URL = "http://consul-provider-payment";

    @Resource
    private RestTemplate restTemplate;

    @RequestMapping("order/consul")
    public String order() {
        return restTemplate.getForObject(INVORK_URL + "/payment/consul", String.class);
    }
}
